const express = require('express');
const { createProjcetService, getAllProjectService, updateProjectService, deleteProjectService } = require('../service/projectService');
const router = express.Router();

// 获取所有项目
router.get("/", async (req, res, next) => {
    res.send(await getAllProjectService());
})

// 新增项目
router.post("/", async (req, res, next) => {
    res.send(await createProjcetService(req.body));
})

// 删除项目
router.delete("/:id", async (req, res, next) => {
    res.send(await deleteProjectService(req.params.id));
})

// 修改项目
router.put("/:id", async (req, res, next) => {
    res.send(await updateProjectService(req.body, req.params.id));
})

module.exports = router;